import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'home',
    meta: {
      title: '仪表盘'
    },
    component: () => import('../views/home.vue')
  },
  {
    path: '/sys',
    name: 'sys',
    meta: {
      title: '常用设置'
    },
    redirect: '/sys/teacher',
    children: [
      {
        path: '/teacher',
        name: 'teacher',
        meta: {
          title: '教师管理'
        },
        component: () => import('../views/sys/teacher.vue')
      },
      {
        path: '/student',
        name: 'student',
        meta: {
          title: '学生管理'
        },
        component: () => import('../views/sys/student.vue')
      },
      {
        path: '/announcement',
        name: 'announcement',
        meta: {
          title: '公告管理'
        },
        component: () => import('../views/sys/announcement.vue')
      },
      {
        path: '/system',
        name: 'system',
        meta: {
          title: '系统管理'
        },
        component: () => import('../views/sys/system.vue')
      },
      {
        path: '/servers',
        name: 'servers',
        meta: {
          title: '判断服务器'
        },
        component: () => import('../views/sys/servers.vue')
      },
     ]
  },
  {
    path: '/issue',
    name: 'issue',
    meta: {
      title: '问题'
    },
    redirect: '/issue/issueList',
    children: [
      {
        path: '/issueList',
        name: 'issueList',
        meta: {
          title: '问题列表'
        },
        component: () => import('../views/issue/list.vue')
      },
      {
        path: '/addIssue',
        name: 'addIssue',
        meta: {
          title: '增加题目'
        },
        component: () => import('../views/issue/add.vue')
      },
      {
        path: '/impandexp',
        name: 'impandexp',
        meta: {
          title: '导入导出题目'
        },
        component: () => import('../views/issue/impandexp.vue')
      },
     ]
  },
  {
    path: '/race',
    name: 'race',
    meta: {
      title: '比赛&练习'
    },
    redirect: '/race/raceList',
    children: [
      {
        path: '/raceList',
        name: 'raceList',
        meta: {
          title: '比赛列表'
        },
        component: () => import('../views/race/list.vue')
      },
      {
        path: '/addRace',
        name: 'addRace',
        meta: {
          title: '创建比赛'
        },
        component: () => import('../views/race/add.vue')
      }
     ]
  },
  {
    path: '/course',
    name: 'course',
    meta: {
      title: '课程'
    },
    redirect: '/course/courseList',
    children: [
      {
        path: '/courseList',
        name: 'courseList',
        meta: {
          title: '课程列表'
        },
        component: () => import('../views/course/list.vue')
      },
      {
        path: '/addCourse',
        name: 'addCourse',
        meta: {
          title: '创建课程'
        },
        component: () => import('../views/course/add.vue')
      }
     ]
  },
]

const router = createRouter({
  history: createWebHistory('/'),
  routes
})
export { routes }

export default router
